package com.czxy.demo01;

public class Test14 {
    public static void main(String[] args) {

        System.out.println("s在字符串中出现的次数:"+getCharNum('s'));


        String s = "this is a test of java";
        String substring = s.substring(10, 14);
        System.out.println(substring);

        String replace = s.replace("java", "JAVASE");
        System.out.println(replace);
    }
    public static int getCharNum(char c){
        String s = "this is a test of java";

        int count = 0;
        for (int i = 0; i <s.length() ; i++) {
            if(s.charAt(i)==c){
                count++;
            }
        }

        return count;
    }
}
